//https://leetcode.cn/problems/set-matrix-zeroes/submissions/657871637/?envType=study-plan-v2&envId=top-interview-150
//矩阵置零
class Solution {
public:
    void setZeroes(vector<vector<int>>& matrix) 
    {
        int n = matrix.size();
        int m = matrix[0].size();
        vector<int> arri(n);
        vector<int> arrj(m);
        for(int i = 0 ; i < n; i++)
        {
            for(int j = 0; j < m; j++)
            {
                if(matrix[i][j] == 0)
                {
                    arri[i] = 1; arrj[j] = 1;
                }
            }
        }

        for(int i = 0 ; i < n; i++)
        {
            for(int j = 0; j < m; j++)
            {
                if(arri[i] || arrj[j]) matrix[i][j] = 0;
            }
        }
    }
};